package com.gastronomy.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gastronomy.dao.NavInfoDao;
import com.gastronomy.entity.NavEntity;
import com.gastronomy.entity.User;
import com.gastronomy.service.NavService;
@Service("navService")
public class NavServiceImpl implements NavService{
	private Logger logger = Logger.getLogger(NavServiceImpl.class);
	
	@Autowired
	private NavInfoDao navInfoDao;
	
	@Override
	public List<NavEntity> listNavs(User user) {
		
		Integer roleId = 0;
		if(user != null){
			roleId = user.getRole().getId();
		}
		System.out.println("---------------------");
		System.out.println(roleId);
		List<NavEntity> list = new ArrayList<NavEntity>();
		try {
			list= navInfoDao.listNavs(roleId);
		} catch (Exception e) {
			logger.error("------error info :"+e.getMessage());
		}
		return list;
	}

}
